{% extends 'center_base.html' %}
{% load staticfiles %}
{% block title %}
    个人中心-我的课程
    {% endblock %}
{% block custom_break %}

<!--crumbs start-->

    <section>
        <div class="wp">
            <ul  class="crumbs">
                <li><a href="{% url 'index' %}">首页</a>></li>
                <li><a href="{% url 'center:info' %}">个人中心</a>></li>
                <li>个人信息</li>
            </ul>
        </div>
    </section>
{% endblock %}
{% block right_form%}
<div class="right" >
            <div class="personal_des Releasecont">
                <div class="head">
                    <h1>我的收藏</h1>
                </div>
            </div>
            <div class="personal_des permessage">
                <div class="head">
                    <ul class="tab_header messagehead">
                        <li><a href="{% url 'center:org_fav' %}">课程机构</a> </li>
                        <li><a href="{% url 'center:teacher_fav' %}">授课教师 </a></li>
                        <li class="active"><a href="{% url 'center:course_fav' %}">公开课程</a></li>
                    </ul>

                </div>
                <div class="companycenter">
                    <div class="group_list brief">
                    {% for course in courses %}
                        <div class="module1_5 box">
                            <a href="{% url 'course:detail' course.id %}">
                                <img width="214" height="190" src="{{MEDIA_URL}}{{ course.image }}"/>
                            </a>
                            <div class="des">
                                <a href="{% url 'course:detail' course.id %}"><h2>{{course.name}}</h2></a>
                                <span class="fl">时长：<i class="key">{{course.learn_times}}</i></span>
                                <span class="fr">学习人数：{{course.students}}</span>
                            </div>
                            <div class="bottom">
                                <span class="fl">{{course.coures_org}}</span>
                                <span class="delete-group fr jsDeleteFav_course" data-favid="{{course.id}}"></span>
                            </div>
                        </div>
                    {% endfor %}
                    </div>
                </div>
            </div>
        </div>
{% endblock %}
{% block custom_js %}
<script type="text/javascript">
$('.jsDeleteFav_course').on('click', function(){

        var _this = $(this),
            favid = _this.attr('data-favid');
        alert(favid)
        $.ajax({
                cache: false,
                type: "POST",
                url: "{% url 'op:fav' %}",
                data: {
                    fav_type: 1,
                    fav_id: favid,
                    csrfmiddlewaretoken: '{{ csrf_token }}'
                },
                async: true,
                success: function(data) {
                    Dml.fun.winReload();
                }
            });
    });
</script>
{% endblock %}